<div id="controls">
	<div class="actions creatable">
		<div class="breadcrumb">
			<div class="crumb svg ui-droppable">
				<a ng-click="logout()"><i class="fa fa-home"></i></a>
			</div>
			<div class="crumb svg">
				<a ng-click="cancelRevision()">{{active_vault.name}}</a>
			</div>
			<div class="crumb svg last">
				<a ng-if="storedCredential.credential_id">{{ 'showing.revisions' | translate}} "{{revision.credential_data.label}}"</a>
			</div>
		</div>
	</div>
</div>


<div off-click="closeSelected()">
	<table class="credential-table" ng-init="menuOpen = false;">
		<tr ng-repeat="revision in revisions | orderBy:'-created'"
			ng-click="selectRevision(revision)"
			ng-class="{'selected': selectedRevision.revision_id == revision.revision_id}">
			<td>
				<span class="icon"><i class="fa fa-lock"></i> </span>
				<span class="label">
					{{ 'revision.of' | translate}} {{revision.created * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}} ({{revision.credential_data.label}})
					<span ng-if="revision.edited_by">{{ 'revision.edited.by' | translate}} {{revision.edited_by}}</span></span>
			</td>
		</tr>
		<tr ng-show="revisions.length == 0">
			<td>{{ 'no.revisions' | translate}}</td>
		</tr>
	</table>

	<div id="app-sidebar" class="detailsView scroll-container app_sidebar"
		 ng-show="selectedRevision">
		<span class="close icon-close" ng-click="closeSelected()"
			  alt="Close"></span>
		<b ng-show="selectedRevision">{{ 'revision.of' | translate}} {{selectedRevision.created * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}</b>
		<div class="credential-data">
			<div class="row" ng-show="selectedRevision.credential_data.label">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'label' | translate }}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><span credential-field
															  value="selectedRevision.credential_data.label"></span></div>
			</div>

			<div class="row" ng-show="selectedRevision.credential_data.username">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'account' | translate }}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><span credential-field
															  value="selectedRevision.credential_data.username"></span></div>
			</div>


			<div class="row" ng-show="selectedRevision.credential_data.password">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'password' | translate }}</div>
				<div class="col-xs-8 col-md-9 col-lg-9">
					<span credential-field value="selectedRevision.credential_data.password" secret="'true'">

					</span>
				</div>
			</div>


			<div class="row" ng-show="selectedRevision.credential_data.otp.secret">
				<div class="col-xs-4 col-md-3 col-lg-3">{{'otp' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><span otp-generator
															  secret="selectedRevision.credential_data.otp.secret"></span></div>
			</div>


			<div class="row" ng-show="selectedRevision.credential_data.email">
				<div class="col-xs-4 col-md-3 col-lg-3">{{'email' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><span credential-field
															  value="selectedRevision.credential_data.email"></span></div>
			</div>

			<div class="row" ng-show="selectedRevision.credential_data.url">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'url' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><span credential-field
															  value="selectedRevision.credential_data.url"></span></div>
			</div>

			<div class="row" ng-show="selectedRevision.credential_data.description">
				<div class="col-xs-4 col-md-3 col-lg-3">{{'notes' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><span credential-field value="selectedRevision.credential_data.description_html"></span></div>
			</div>

			<div class="row" ng-show="selectedRevision.credential_data.files.length > 0">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'files' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9"><div ng-repeat="file in selectedRevision.credential_data.files"
															 class="link" ng-click="downloadFile(selectedRevision.credential_data, file)">
					{{file.filename}} ({{file.size | bytes}})
				</div></div>
			</div>

			<div class="row" ng-repeat="field in selectedRevision.credential_data.custom_fields">
				<div class="col-xs-4 col-md-3 col-lg-3">{{field.label}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9">
					<span credential-field value="field.value" secret="field.secret" ng-if="field.field_type !== 'file' || !field.field_type"></span>
					<span ng-if="field.field_type === 'file'" class="link" ng-click="downloadFile(selectedCredential, field.value)">{{field.value.filename}} ({{field.value.size | bytes}})</span>
				</div>
			</div>


			<div class="row" ng-show="selectedRevision.credential_data.expire_time > 0">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'expire.time' | translate }}</div>
				<div class="col-xs-8 col-md-9 col-lg-9">
					{{selectedRevision.credential_data.expire_time * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}
				</div>
			</div>


			<div class="row" ng-show="selectedRevision.credential_data.changed">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'changed' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9">
					{{selectedRevision.credential_data.changed * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}
				</div>
			</div>


			<div class="row" ng-show="selectedRevision.credential_data.created">
				<div class="col-xs-4 col-md-3 col-lg-3">{{ 'created' | translate}}</div>
				<div class="col-xs-8 col-md-9 col-lg-9">
					{{selectedRevision.credential_data.created * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}
				</div>
			</div>

			<div class="row">
				<div class="col-xs-12">
					<div class="tags">
						<span class="tag" ng-repeat="tag in selectedRevision.credential_data.tags">{{tag.text}}</span>
					</div>
				</div>
			</div>
		</div>
<!--
		<table class="revision-details">
			<tr ng-show="selectedRevision.credential_data.label">
				<td>
					{{ 'label' | translate}}
				</td>
				<td>
					{{selectedRevision.credential_data.label}}
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.username">
				<td>
					{{ 'account' | translate}}
				</td>
				<td>
					<span credential-field
						  value="selectedRevision.credential_data.username"></span>
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.password">
				<td>
					{{ 'password' | translate}}
				</td>
				<td>
					<span credential-field value="selectedRevision.credential_data.password"
						  secret="'true'"></span>
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.otp.secret">
				<td>
					{{ 'otp' | translate}}
				</td>
				<td>
					<span otp-generator
						  secret="selectedRevision.credential_data.otp.secret"></span>
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.email">
				<td>
					{{ 'email' | translate}}
				</td>
				<td>
					<span credential-field
						  value="selectedRevision.credential_data.email"></span>
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.url">
				<td>
					{{ 'url' | translate}}
				</td>
				<td>
					<span credential-field
						  value="selectedRevision.url"></span>
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.files.length > 0">
				<td>
					{{ 'files' | translate}}
				</td>
				<td>
					<div ng-repeat="file in selectedRevision.credential_data.files"
						 class="link" ng-click="downloadFile(file)">
						{{file.filename}} ({{file.size | bytes}})
					</div>
				</td>
			</tr>
			<tr ng-repeat="field in selectedRevision.credential_data.custom_fields">
				<td>
					{{field.label}}
				</td>
				<td>
					<span credential-field value="field.value"
						  secret="field.secret"></span>
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.changed">
				<td>
					{{ 'changed' | translate}}
				</td>
				<td>
					{{selectedRevision.credential_data.changed * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}
				</td>
			</tr>
			<tr ng-show="selectedRevision.credential_data.created">
				<td>
					{{ 'created' | translate}}
				</td>
				<td>
					{{selectedRevision.credential_data.created * 1000 | date:'dd-MM-yyyy @ HH:mm:ss'}}
				</td>
			</tr>

		</table>
-->
		<div ng-show="selectedRevision">
			<button class="button" ng-click="restoreRevision(selectedRevision)" >
				<span class="fa fa-edit"></span> {{ 'restore.revision' | translate}}
			</button>
			<button class="button" ng-click="deleteRevision(selectedRevision)" >
				<span class="fa fa-trash"></span> {{ 'delete.revision' | translate}}
			</button>
		</div>

	</div>
</div>
